home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / awe2-0_1.lha / awe2-0.1 / Src / RCS / MLCG.h,v < prev    next >
Text File  |  1989-02-23  |  3KB  |  155 lines

  1. head     3.2;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    grunwald:3.2; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 3.2
  10. date     89.02.20.15.36.04;  author grunwald;  state Exp;
  11. branches ;
  12. next     3.1;
  13.  
  14. 3.1
  15. date     88.12.20.13.50.04;  author grunwald;  state Exp;
  16. branches ;
  17. next     1.2;
  18.  
  19. 1.2
  20. date     88.10.30.13.05.56;  author grunwald;  state Exp;
  21. branches ;
  22. next     1.1;
  23.  
  24. 1.1
  25. date     88.09.18.16.42.11;  author grunwald;  state Exp;
  26. branches ;
  27. next     ;
  28.  
  29.  
  30. desc
  31. @@
  32.  
  33.  
  34. 3.2
  35. log
  36. @Start using Gnu library heaps for schedulers
  37. @
  38. text
  39. @// This may look like C code, but it is really -*- C++ -*-
  40. /* 
  41. Copyright (C) 1988 Free Software Foundation
  42.     written by Dirk Grunwald (grunwald@@cs.uiuc.edu)
  43.  
  44. This file is part of GNU CC.
  45.  
  46. GNU CC is distributed in the hope that it will be useful,
  47. but WITHOUT ANY WARRANTY.  No author or distributor
  48. accepts responsibility to anyone for the consequences of using it
  49. or for whether it serves any particular purpose or works at all,
  50. unless he says so in writing.  Refer to the GNU CC General Public
  51. License for full details.
  52.  
  53. Everyone is granted permission to copy, modify and redistribute
  54. GNU CC, but only under the conditions described in the
  55. GNU CC General Public License.   A copy of this license is
  56. supposed to have been given to you along with GNU CC so you
  57. can know your rights and responsibilities.  It should be in a
  58. file named COPYING.  Among other things, the copyright notice
  59. and this notice must be preserved on all copies.  
  60. */
  61. #ifndef _MLCG_h
  62. #define _MLCG_h 1 
  63.  
  64. #include "RNG.h"
  65. #include <math.h>
  66.  
  67. //
  68. //    Multiplicative Linear Conguential Generator
  69. //
  70.  
  71. class MLCG : public RNG {
  72.     long initialSeedOne;
  73.     long initialSeedTwo;
  74.     long seedOne;
  75.     long seedTwo;
  76.  
  77. protected:
  78.  
  79. public:
  80.     MLCG(long seed1 = 0, long seed2 = 1);
  81.     //
  82.     // Return a long-words word of random bits
  83.     //
  84.     virtual unsigned long asLong();
  85.     virtual void reset();
  86.     long seed1();
  87.     void seed1(long);
  88.     long seed2();
  89.     void seed2(long);
  90.     void reseed(long, long);
  91. };
  92.  
  93. inline long
  94. MLCG::seed1()
  95. {
  96.     return(seedOne);
  97. }
  98.  
  99. inline void
  100. MLCG::seed1(long s)
  101. {
  102.     initialSeedOne = s;
  103.     reset();
  104. }
  105.  
  106. inline long
  107. MLCG::seed2()
  108. {
  109.     return(seedTwo);
  110. }
  111.  
  112. inline void
  113. MLCG::seed2(long s)
  114. {
  115.     initialSeedTwo = s;
  116.     reset();
  117. }
  118.  
  119. inline void
  120. MLCG::reseed(long s1, long s2)
  121. {
  122.     initialSeedOne = s1;
  123.     initialSeedTwo = s2;
  124.     reset();
  125. }
  126.  
  127. #endif
  128. @
  129.  
  130.  
  131. 3.1
  132. log
  133. @Steay version
  134. @
  135. text
  136. @@
  137.  
  138.  
  139. 1.2
  140. log
  141. @*** empty log message ***
  142. @
  143. text
  144. @@
  145.  
  146.  
  147. 1.1
  148. log
  149. @Initial revision
  150. @
  151. text
  152. @d48 5
  153. d54 34
  154. @
  155.